/**
 * 战斗和BOSS相关API
 */
import { get, post } from './request'

// 开始战斗
export function startBattle(enemyId, formationId) {
  return post('/battle/start', {
    enemy_id: enemyId,
    formation_id: formationId
  })
}

// 获取战斗结果
export function getBattleResult(battleId) {
  return get(`/battle/result/${battleId}`)
}

// 挂机相关
// 领取挂机收益
export function claimAfkReward(claimOffline = true, claimCurrent = true) {
  return post('/afk/claim', {
    claim_offline: claimOffline,
    claim_current: claimCurrent
  })
}

// 快速战斗
export function quickBattle(count = 1) {
  return post('/afk/quick_battle', {
    count
  })
}

// BOSS相关
// 获取世界BOSS列表
export function getWorldBossList() {
  return post('/boss/world/list')
}

// 挑战世界BOSS
export function challengeWorldBoss(bossId, formationId) {
  return post('/boss/world/challenge', {
    boss_id: bossId,
    formation_id: formationId
  })
}

// 获取个人BOSS列表
export function getPersonalBossList() {
  return post('/boss/personal/list')
}

// 挑战个人BOSS
export function challengePersonalBoss(bossId, formationId) {
  return post('/boss/personal/challenge', {
    boss_id: bossId,
    formation_id: formationId
  })
}

// 扫荡个人BOSS
export function sweepPersonalBoss(bossId, count = 1) {
  return post('/boss/personal/sweep', {
    boss_id: bossId,
    count
  })
}

// 购买BOSS挑战次数
export function buyBossChallengeTimes(bossId, count = 1) {
  return post('/boss/buy_times', {
    boss_id: bossId,
    count
  })
}

// 一键挑战所有BOSS
export function challengeAllBoss() {
  return post('/boss/challenge_all')
}

// 一键扫荡所有BOSS
export function sweepAllBoss() {
  return post('/boss/sweep_all')
}

export default {
  startBattle,
  getBattleResult,
  claimAfkReward,
  quickBattle,
  getWorldBossList,
  challengeWorldBoss,
  getPersonalBossList,
  challengePersonalBoss,
  sweepPersonalBoss,
  buyBossChallengeTimes,
  challengeAllBoss,
  sweepAllBoss
}